package cn.ylz.ylmall.order.service;

import cn.ylz.ylmall.order.pojo.entity.OrderDetail;
import cn.ylz.ylmall.order.pojo.request.OrderCreateReq;
import cn.ylz.ylmall.order.pojo.request.SingleOrderReq;
import cn.ylz.ylmall.order.pojo.vo.OrderDetailVO;
import com.github.pagehelper.PageInfo;
import io.swagger.models.auth.In;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
* @author ks
* @description 针对表【order(订单表)】的数据库操作Service
* @createDate 2023-08-10 10:10:20
*/
public interface OrderDetailService {

    /**
     * 增加订单
     * @param orderCreateReq
     * @param userId
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    List<String> insertOrder(OrderCreateReq orderCreateReq, Long userId);

    /**
     * 查询订单
     * @param orderNo
     * @param userId
     * @return
     */
    OrderDetailVO selectOrder(String orderNo, Long userId);


    /**
     * 删除订单
     * @param orderNo
     * @param userId
     * @return
     */
    int deleteOrder(String orderNo, Long userId);

    /**
     * 查询订单列表
     * @param userId
     * @return
     */
    PageInfo<OrderDetailVO> selectOrderList(Long userId, Integer pageNum,Integer pageSize);

    /**
     * 修改数据
     * @param userId
     * @param orderDetail
     * @return
     */
    int updateOrder(OrderDetail orderDetail, Long userId);

    /**
     * 获取订单二维码
     * @param orderNo
     * @return
     */
    String getQrCode(String orderNo);

    /**
     * 根据订单状态查询订单列表
     * @param orderStatus
     * @param pageNum
     * @param pageSize
     * @return
     */
    PageInfo<OrderDetailVO> selectOrderStatus(Integer orderStatus, Integer pageNum,Integer pageSize);

    /**
     * 取消订单
     * @param userId
     * @param orderNo
     * @return
     */
    int cancelOrder(Long userId, String orderNo);

    /**
     * 支付订单
     * @param orderNo
     * @return
     */
    int payOrder(String orderNo);

    String createdSingleOrder(SingleOrderReq singleOrderReq,Long userId);
}
